#!/bin/bash
# Created Time:    2017-04-19 09:52:50
# Modified Time:   2017-04-19 13:26:13
#set -e # 这告诉bash一但有任何一个语句返回非真的值，则退出bash。
RESTART=$1
PNAME=$2

#if [ PNAME ]; then
#    echo "please set project dir name!"
#    exit 2
#fi

if [ -d "/var/lib/ambari-server/resources/stacks/HDP/2.5/services/${PNAME}" ]; then
    cd /var/lib/ambari-server/resources/stacks/HDP/2.5/services/${PNAME}
else
    exit 2
fi

git pull

if [ $1 ]; then
    ambari-server restart
fi